<!DOCTYPE HTML>
<%@LANGUAGE="JAVASCRIPT" %>
<!--#include file ="Includes/DB.asp"--> <!-- Namespace: DB -->
<!--#include file ="Includes/JSON2.asp"-->
<!--#include file ="Includes/ASPHelpers.asp"--> <!-- Namespace: Helpers -->
<!--#include file ="ScriptReaderModel.asp"-->


<%
	var model = new ScriptReaderModel();
	model.Init();

%>


<html>
<% Response.AddHeader("X-UA-Compatible", "IE=edge"); %>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta charset="utf-8">
<title>Script Editor Preview</title>

<link rel="stylesheet" type="text/css" href="Content/Styles/AfterHours.css">
<link rel="stylesheet" type="text/css" href="Content/Styles/ScriptReader.css">


</head>

<body>

<!-- HEADER -->

<h1 class="pageTitle"><%= model.Title %> &nbsp;&nbsp;&nbsp;&nbsp; (<%= model.Category %>) </h1>

<!-- /HEADER -->

<!-- ====================================================================== -->

<!-- CONTENT -->

<div class="scriptBlock" scriptblockid="<%= model.InitialScriptBlock.ScriptBlockID %>" parentdecisionid="0">
    <div class="scriptText">
        <%= model.InitialScriptBlock.ScriptText %>
    </div>
    <div class="decisionBlock">
        <ul class="scriptDecisions">
        <%
            var html = [];
            
            for(var x = 0, len = model.InitialDecisions.length; x < len; x++){
                var curDecision = model.InitialDecisions[x];
                
                html.push(
                    "<li class='scriptDecision' decisionid='", curDecision.DecisionID , "' childscriptblockid='", curDecision.ChildScriptBlockID, "'>",
                        "<a>",
                            curDecision.DecisionTitle,
                        "</a>",
                        "<div class='scriptBlock loading hidden' scriptblockid='", curDecision.ChildScriptBlockID, "'></div>",
                    "</li>"
                );
            }
            
            Response.Write(html.join(""));
        %>
        </ul>
    </div>
</div>

<!-- /CONTENT -->

<!-- ====================================================================== -->

<script src="Content/Scripts/jquery.js" type="text/javascript"></script>
<script src="Content/Scripts/jQueryExtensions.js" type="text/javascript"></script>
<script src="Content/Scripts/ScriptReader.js" type="text/javascript"></script>



<!-- TEMPLATES -->

<script type="template" id="decisionTemplate">
    <li class="scriptDecision" decisionid="{DecisionID}" childscriptblockid="{ChildScriptBlockID}">
        <a>
            {DecisionTitle}
        </a>
        <div class="scriptBlock loading hidden" scriptblockid="{ChildScriptBlockID}"></div>
    </li>
</script>


<script type="template" id="scriptBlockTemplate">
    <div class="scriptBlock" scriptblockid="{ScriptBlockID}" parentdecisionid="{ParentDecisionID}">
        <div class="scriptText">
            {ScriptText}
        </div>
        <div class="decisionBlock">
            <ul class="scriptDecisions">
                {ScriptDecisions}
            </ul>
        </div>
    </div>
</script>




</body>
</html>
